package com.serviceImpl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.dao.InfoMapper;
import com.pojo.Info;
import com.service.IInfoService;

@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 5)
@Service("infoService")
public class InfoServiceImpl implements IInfoService {

	@Resource
	private InfoMapper infoMapper;

	@Override
	public List<Info> getInfos(int page, int groups) {
		return infoMapper.getinfos((page-1)*groups,groups);
	}

	@Override
	public Info getInfoById(int id) {
		return infoMapper.getInfoById(id);
	}

	@Override
	public Info addinfo(Info info, int userid) {
		infoMapper.addinfo(info, userid);
		return info;
	}

	@Override
	public void deleinfo(int id) {
		infoMapper.deleinfo(id);
	}

	public int getCounts() {
		return infoMapper.getCount();
	}

}
